from fastapi_amis_admin import amis, admin
from fastapi_amis_admin.admin import AdminApp
from admin_demo.backend.apps.nation.models import Nation
# from .models import Category


class NationApp(admin.AdminApp):
    page_schema = amis.PageSchema(label='Nation', icon='fa fa-bolt')
    router_prefix = '/nation'

    def __init__(self, app: "AdminApp"):
        super().__init__(app)
        self.register_admin(NationAdmin)


# Register your models here.

class NationAdmin(admin.ModelAdmin):
    page_schema = amis.PageSchema(label='Nation', icon='fa fa-folder')
    model = Nation
    search_fields = [Nation.name]
